interface IFry{//接口
    void Fry();
}
interface Iswim{//接口
    void Swim();
}
abstract class Animal {
    public int age;
    public String name;

    public Animal(int age, String name) {
        this.age = age;
        this.name = name;
    }
    public void Eat() {
        System.out.println("动物吃食物");
    }
    public void Break() {
        System.out.println("动物叫");
    }
}
class Brid extends Animal implements IFry{//继承
    public Brid(int age,String name){
        super(age,name);
    }
    public void Eat() {
        System.out.println(name+"在吃鸟食");
    }
    public void Break(){
        System.out.println(name+"在鸟叫");
    }
    public  void Fry(){
        System.out.println(name+"正在飞");
    }
}
class Dack extends Animal implements Iswim{//继承
    public Dack(int age,String name){
        super(age,name);
    }
    public void Eat() {
        System.out.println(name+"在吃鸭食");
    }
    public void Break(){
        System.out.println(name+"在鸭叫");
}
    public  void Swim(){
        System.out.println(name+"正在游泳");
    }
}
public class Main {
    public static void func(IFry iFry){
        iFry.Fry();
    }
    public static void func(Iswim iswim){

        iswim.Swim();
    }
    public static void func1(Dack dack){
        dack.Eat();
        dack.Break();
    }
    public static void func1(Brid brid){
        brid.Eat();
        brid.Break();
    }
    public static void main(String[] args) {
        Brid brid=new Brid(2,"xxx");
        Animal animal=brid;
        animal.Eat();
        func1(brid);//向上转型
        func1(new Dack(2,"xx"));//向上转型
    func(new Brid(1,"x"));//向上转型
    func(new Dack(2,"xx"));//向上转型
    }
}